<?php

/*
 * It is used to register the email subscription 
 * Getting data from ajax
 * 
 */
$pathinfo = pathinfo(__FILE__);
preg_match('/.+(?=wp-content)/', $pathinfo['dirname'], $match);
$pathNeeded = preg_replace('/\ /', '/', $match[0]);
require_once($pathNeeded . 'wp-load.php'); //refer to wp-load to use instruction

global $wpdb;
$typeRequest = RequestAQoute::REQUEST_A_QUOTE;
 
$typeFlights =  $_REQUEST['typeFlights'];
if(($typeFlights == 1)||($typeFlights == 2)){
    $ds_startlocation_all[0] = $_REQUEST['startLocation']; 
    $ds_endlocation_all[0]   = $_REQUEST['endLocation'];
    $ds_startTime_all[0] = $_REQUEST['startDate'];
    $ds_EndTime_all[0] = $_REQUEST['endDate'];
    
}
 else {
   $ds_startlocation_all = $_REQUEST['startLocation'] ; 
   $ds_endlocation_all   = $_REQUEST['endLocation'];
   $ds_startTime_all     = $_REQUEST['startDate'];
   $ds_EndTime_all = $_REQUEST['endDate'];
}




 RequestAQoute::insertRequestAQoute($_REQUEST['typeFlights'],$_REQUEST['name'],$_REQUEST['email'],$_REQUEST['phone'],$ds_startlocation_all,$ds_endlocation_all,$ds_startTime_all, $ds_EndTime_all, $_REQUEST['adult'], $_REQUEST['children'], $_REQUEST['class'], $_REQUEST['infant'], $_REQUEST['city'],$typeRequest);
 

